package tech.aistar.corejava.day03;

import static tech.aistar.corejava.day03.IsLeapYear.isLeapYear;


public class YearDemo {
    public static void main(String[] args) {
        System.out.println(maxDay(2016,3));
    }
    /**
     * @Author:         lya
     * @Description:   本类的作用描述:某月的最大天数
     * @param:          year,month
     * @return          maxday
     * @CreateDate:    2019/7/20 14:44
     * @Version:       1.0
    */
    public static int maxDay(int year,int month){
        int maxday = 0;
        switch (month){
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                maxday += 31;
                break;
            case 2:
                maxday += isLeapYear(year)?29:28;
                break;
             default:
                 maxday += 30;
        }
        return maxday;
    }
}
